﻿using Sasc.PV.BLL;
using Sasc.PV.BLL.ZhuDing;
using Sasc.PV.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Sasc.PV.Web.Admin.Zhuding
{
    public partial class ShaoJieYunZhuanView : PVAdminPage
    {
        #region Page Load
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var model = new PvZDShaoJieCollection();
                model = model.GetModel(int.Parse(Request.QueryString["ID"].ToString()));

                GanGuoZhuiZongDanMatchTextBoxLabel.Text = model.GanGuoZhuiZongDanMatch?"是":"否";
                JianCheDanZhuiZongDanOKLabel.Text = model.JianCheDanZhuiZongDanOK ? "是" : "否";
                JiaReBangOKLabel.Text = model.JiaReBangOK ? "是" : "否";
                ShaoJieLuBianHaoLabel.Text = model.ShaoJieLuBianHao;
                ShaoJieLuYunXingJianChaRenLabel.Text = model.YunXingQianJiaChaRen;
                BeiZhuLabel.Text = WebUtils.ConvertTextToHTML(model.BeiZhu);
                GongYiMingChengLabel.Text = model.GongYiMingCheng;
                CreatedByLabel.Text = model.CreatedBy;
                CreatedDateLabel.Text = model.CreatedDate.Format();
                LastUpdatedByLabel.Text = model.LastUpdatedBy;
                LastUpdatedDateLabel.Text = model.LastUpdatedDate.Format();

                DataBindToShaoJieGridview();
                DataBindToShaoJieYunXingGridView();
            }
        }
        #endregion


        #region 坩埚烧结信息
        protected void DataBindToShaoJieGridview()
        {
            var MyModel = new PvZDShaoJie();
            var dataSet = MyModel.GetList(" ShaoJieCollectionID=" + Request.QueryString["ID"].ToString());
            ShaoJieGVData.DataSource = dataSet;
            ShaoJieGVData.DataBind();
        }
        protected void ShaoJieGVData_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            PublicMethod.GridViewRowDataBound(e);
        }
        #endregion

        #region 烧结炉运行记录
        protected void DataBindToShaoJieYunXingGridView()
        {
            var MyModel = new PvZDShaoJieYunXing();
            var dataSet = MyModel.GetList(" ShaoJieCollectionID=" + Request.QueryString["ID"].ToString());
            ShaoJieYunXingGridView.DataSource = dataSet;
            ShaoJieYunXingGridView.DataBind();
        }

        protected void ShaoJieYunXingGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            PublicMethod.GridViewRowDataBound(e);
        }
        #endregion
    }
}